var {ipcRenderer} = require('electron');
/* 通过 remote获取 渲染进程的 */
var BrowserWindow =require('electron').remote.BrowserWindow;
var textarea=this.document.querySelector('#textarea');
//获取localStorage的数据
var author=localStorage.getItem('author');

//console.log(author);
window.onload = function () {
    textarea.innerHTML="通过localStorage传递的值:"+localStorage.getItem('author');
}
//接收 通过win.webContents.send 传的值
ipcRenderer.on('toNews',function(event,data,winId){
    // console.log("win.webContents.send传的值：",data,winId);
    textarea2.innerHTML="通过win.webContents.send传递的值:"+data+" winId:"+winId;
    //再把值传给 渲染进程
    var firstWin=BrowserWindow.fromId(winId);
    firstWin.webContents.send('toIndex','from-news');

})
